package com.wit.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

import com.wit.po.Employee;
import com.wit.service.impl.EmployeeserviceImp;

public class Login {
	private String Uaccount;
	private String pwd;
	private HttpServletRequest request = ServletActionContext.getRequest();
	public String getUaccount() {
		return Uaccount;
	}
	public void setUaccount(String uaccount) {
		Uaccount = uaccount;
	}
	public String getPwd() {
		return pwd;
	}
	public void setPwd(String pwd) {
		this.pwd = pwd;
	}
	public HttpServletRequest getRequest() {
		return request;
	}
	public void setRequest(HttpServletRequest request) {
		this.request = request;
	}
	public String LoginAction()
	{
		EmployeeserviceImp emp=new EmployeeserviceImp();
		Employee em=emp.login(Uaccount, pwd);
		if(em==null)
		{
			return "faile";
		}
		else{
			request.getSession().setAttribute("employee",em);
			return "success";
			
		}
	}
	

}
